package com.sys.object.common;

/**
 * @author jiwei
 * 系统状态码
 */
public enum ObjResultCode {	
	OK(1,"成功"),
	NO_DATA(0,"没有数据"),
	ERROR(2,"系统错误"),
	DATA_ERROR(3,"读取数据错误"),
	UPDATE_ERROR(4,"修改失败"),
	SAVE_ERROR(5,"保存数据出错"),
	
	USER_LOGIN_ERROR(101,"用户名或者密码错误"),
	USER_LOGIN_DELETE(102,"用户不存在或者已被解冻"),
	USER_PASS_ERROR(103,"更新密码错误"),
	USER_OLDPASS_ERROR(103,"原密码错误"),
	USER_NAME_NULL(104,"用户名不能为空"),
	USER_PASS_NULL(105,"密码不能为空"),
	USER_EMAIL_NULL(106,"邮箱号不能为空"),
	USER_NAME_EXIST(107,"用户名已存在"),
	USER_UNKNOWN_ACCOUNT(108,"未知账户"),
	USER_PASSWORD_ERROR(109,"密码不正确"),
	USER_ACCOUNT_LOCKED(110,"账户已锁定"),
	USER_LOGIN_TIMES_ERROR(111,"用户名或密码错误次数过多"),
	USER_LOGIN_USERNAME_PASSWORD_ERROR(112,"用户名或密码不正确"),
	USER_PASSWORD_UPDATE_SUCCESS(113,"密码修改成功"),
	USER_PASSWORD_UPDATE_FAILURE(114,"密码修改失败"),
	USER_SAFETY_EXIT_LOGIN(115,"您已安全退出"),
	USER_SESSION_EXIT_LOGIN(115,"您的登录已失效，新刷新重新登录"),
	
	SYS_USER_DELETE_FAILED(116,"系统用户删除失败"),
	SYS_USER_UPDATE_FAILED(117,"系统用户修改失败"),
	SYS_USER_STATUS_UPDATE_FAILED(118,"系统用户状态修改失败"),
	SYS_USER_NAME_PASS_NULL(119,"请输入用户名和密码"),
	
	AUTHORITY_ADD_ERROR(120,"新增权限出错"),
	AUTHORITY_UPDATE_ERROR(121,"权限角色出错"),
	AUTHORITY_DELETE_ERROR(122,"角色权限失败"),
	
	MODULE_ADD_ERROR(123,"新增模块出错"),
	MODULE_UPDATE_ERROR(124,"修改模块出错"),
	MODULE_DELETE_ERROR(125,"模块删除失败"),
	
	ROLE_ADD_ERROR(126,"新增角色出错"),
	ROLE_UPDATE_ERROR(127,"修改角色出错"),
	ROLE_DELETE_ERROR(128,"角色删除失败"),
	CLASS_SELECT_ERROR(129,"类型还没有选择"),
	
	USER_ICARD_EIXT(130,"身份证号已存在"),
	USER_ICARD_NULL(130,"身份证号不能为空"),
	USER_MOBILE_EIXT(131,"手机号已存在"),
	USER_MOBILE_NULL(131,"手机号不能为空"),
	C1_EXAMDATE_NULL(132,"科一的考试时间不能为空"),
	
	SYS_SMS_ERROR(133,"发送短信失败"),
	SYS_SMS_SUCC_MYSQL_ERROR(133,"发送短信成功，但保存数据失败"),
	SYS_SMS_MOBILE_ERROR(134,"手机号为无效"),
	SYS_SMS_TEMPLATE_ERROR(135,"短信模块出错"),
	SYS_SMS_ERROR_MYSQL_ERROR(133,"发送短信失败，但保存数据失败"),
	
	QUARTZ_ADD_ERROR(10101,"新增任出错信息出错"),
	QUARTZ_TIME_OVER_ERROR(10101,"任务时间已经结束，请选编辑调整作务时间"),
	QUARTZ_WARN_TIME_0(10101,"提醒时间未设置，请先去设置提醒时间"),
	
	QUARTZ_ADD_GETCLASS_ERROR(10102,"未找到目标类！"),//
	QUARTZ_ADD_GETCLASS_MOTHED_ERROR(10103,"未找到目标方法！"),
	QUARTZ_ADD_SAVE_ERROR(10104,"保存失败，检查 name group 组合是否有重复！"),
	QUARTZ_CHANGE_STATUS_ERROR(10105,"任务状态改变失败！"),//
	QUARTZ_UPDATE_CRON_ERROR(10106,"cron表达式有误，不能被解析！"),
	QUARTZ_CRON_NULL(10106,"请先设置频率cron表达式！"),
	QUARTZ_TASK_NULL(10106,"任务已完成或者已删除！"),
	QUARTZ_UPDATE_CRON_DATA_ERROR(10107,"cron更新失败！"),
	HAVE_EXISTED(2001,"数据已经存在！"),

	;
	
	private Integer code;
	private String desc;

	ObjResultCode(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public String getDesc() {
		return desc;
	}

	public Integer getCode() {
		return code;
	}

	public static ObjResultCode getResultCode(Integer code) {
		for (ObjResultCode e : values()) {
			if(e.getCode().equals(code))
				return e;
		}
		return null;
	}
}
